In [1]:
import context

import gopro_helper as gopro

In [2]:
%load_ext autoreload
%autoreload 2

Camera Raw Status and Settings Information


In [23]:
raw_status, raw_settings = gopro.commands.get_raw_status_settings()

In [24]:
info_status = gopro.api.parse_status_names(raw_status)

In [25]:
info_status


Out[25]:
Struct([('external_battery_present', 0),
        ('external_battery_level', 255),
        ('system_hot', 0),
        ('system_busy', 0),
        ('quick_capture_active', 0),
        ('encoding_active', 0),
        ('lcd_lock_active', 0),
        ('camera_locate_active', 0),
        ('current_time_msec', 153138),
        ('next_poll_msec', 500),
        ('analytics_ready', 2),
        ('analytics_size', 0),
        ('in_contextual_menu', 0),
        ('gps_status', 0),
        ('acc_mic_status', 0),
        ('mode', 0),
        ('sub_mode', 0),
        ('video_selected_flatmode', 12),
        ('photo_selected_flatmode', 17),
        ('timelapse_selected_flatmode', 20),
        ('sd_status', 0),
        ('remaining_photos', 9360),
        ('remaining_video_time', 9029),
        ('num_group_photos', 1),
        ('num_group_videos', 0),
        ('num_total_photos', 1),
        ('num_total_videos', 0),
        ('remaining_space', 62297984),
        ('num_hilights', 0),
        ('last_hilight_time_msec', 0),
        ('remaining_timelapse_time', 0),
        ('date_time', '%11%06%19%12%0C%2B'),
        ('battery_percentage', 0),
        ('battery_present', 1),
        ('battery_level', 0)])

In [5]:
gopro.api.parse_mode_sub_mode(info_status)


Out[5]:
('video', 'Video')

List Camera Modes


In [3]:
gopro.api.camera_modes()


Out[3]:
['video', 'audio', 'photo', 'multi_shot', 'setup']

List Mode Feature Names


In [6]:
# m = 'video'
# m = 'photo'
# m = 'audio'
m = 'multi_shot'
m = 'setup'

features = gopro.api.mode_features(m)
    
for F in features:
    print('{:2d} - {:22s} [{}]'.format(F['id'], F['path_segment'], F['display_name']))


51 - lcd_sleep              [Screensaver]
52 - orientation            [Auto-Rotation]
89 - default_app_mode_flat  [Default Mode]
92 - current_flat_mode      [Current Flat Mode]
54 - quick_capture          [Quick Capture]
91 - led_v2                 [LED]
83 - gps                    [GPS]
84 - language               [Language]
85 - voice_control_language [Voice Control Language]
86 - local_voice_control    [Voice Control Enable]
88 - lcd_brightness_v2      [LCD Brightness]
87 - beep_volume_v2         [Beeps]
57 - video_format           [Video Format]
59 - auto_power_down        [Auto Off]
60 - stream_gop_size        [Secondary Stream GOP Size]
61 - stream_idr_interval    [Secondary Stream IDR Interval]
62 - stream_bit_rate        [Secondary Stream Bit Rate]
64 - stream_window_size     [Secondary Stream Window Size]
95 - acc_mic_mode           [Audio Input]

List Feature Options


In [10]:
# m = 'video'
# m = 'photo'
# m = 'audio'
# m = 'multi_shot'
m = 'setup'

fid = 92

name, fid, options = gopro.api.feature_options(m, fid)

print('Option IDs and values for mode="{}" and feature="{}":'.format(m, name))
for item in options:
    print('[{:2d}] - {} '.format(item['value'], item['display_name']))


Option IDs and values for mode="setup" and feature="current_flat_mode":
[12] - Video 
[14] - Video + Photo 
[15] - Looping 
[13] - Time Lapse Video 
[16] - Single Photo 
[17] - Photo 
[18] - Night Photo 
[19] - Burst Photo 
[21] - Night Lapse Photo 
[20] - Time Lapse Photo 

Reverse Lookup Feature Names and IDs


In [5]:
m = 'video'
gopro.api.feature_id_name(m, 10)


Out[5]:
'protune'

In [15]:
m = 'photo'
gopro.api.feature_name_id(m, 'photo_selected_flatmode')


---------------------------------------------------------------------------
ValueError                                Traceback (most recent call last)
<ipython-input-15-78d38ccdd4e2> in <module>()
      1 m = 'photo'
----> 2 gopro.api.feature_name_id(m, 'photo_selected_flatmode')

~/Projects/GoProHelper/gopro_helper/api.py in feature_name_id(mode, name)
    230     """Return feature ID belonging to supplied name
    231     """
--> 232     name, fid, options = feature_options(mode, name)
    233     return fid
    234 

~/Projects/GoProHelper/gopro_helper/api.py in feature_options(mode, name_or_id)
    201             return name, fid, options
    202 
--> 203     raise ValueError('Invalid mode/feature combination: "{}", "{}"'.format(mode, name_or_id))
    204 
    205 

ValueError: Invalid mode/feature combination: "photo", "photo_selected_flatmode"

In [ ]: